<template>
  <el-dialog
    :title="title"
    :visible.sync="visible"
    width="50%"
    :before-close="handleClose"
    :close-on-click-modal="false"
    :close-on-press-escape="false"
    :show-close="false"
    :destroy-on-close="true"
    :append-to-body="true"
  >
    <slot></slot>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="confirm">确 定</el-button>
      <el-button class="bs-left-10" @click="handleClose">取 消</el-button>
    </div>
  </el-dialog>

</template>

<script>
export default {
  name: 'BsDialog',
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    title: {
      type: String,
      default: '提示'
    }
  },
  data() {
    return {
    }
  },
  methods: {
    handleClose() {
      this.$emit('close', false)
    },
    confirm() {
      this.$emit('confirm')
    }
  }
}
</script>

<style lang="scss" scoped>

.dialog-footer {
  text-align: right;
  .bs-left-10{
    margin-left: 10px;
  }
}

</style>
